﻿// -------------------------------------------------------------------------
//    @FileName         :    NFCityNpc.h
//    @Author           :    Gao.Yi
//    @Date             :    2025-09-28
//    @Email			:    445267987@qq.com
//    @Module           :    NFCityNpc
//    @Desc             :
//
// -------------------------------------------------------------------------

#pragma once

#include "NFCityNpcLevelExt.h"
#include "NFComm/NFObjCommon/NFObject.h"
#include "NFCityWorldObject.h"
#include "NFLogicCommon/NFLogicShmTypeDefines.h"

namespace proto_ff
{
    class CityNpcInfo;
}

class NFCityNpc : public NF_OBJECT_TEMPLATE_MACRO(NFCityNpc, EOT_CITY_NPC_ID, NFCityWorldObject)
public:
    NFCityNpc();
    ~NFCityNpc() override;
    int CreateInit();
    int ResumeInit();

public:
    int Init(int iNpcID, int iLeftTime);
    int OnTimer(int timeId, int callCount) override;
    int TickSec();
    int Refresh(int iLeftTime);
    int SynNpcInfo(const proto_ff::CityNpcInfo& rInfo);
    bool IsVisibleByLevel(int iLevel);
    bool IsVisibleByQuest(int iQuestId);
    bool IsVisible(NFCityWorldObject* pAcceptWO) override;

public:
    int GetNpcID() const { return m_iNpcId; }
    void SetNpcCamp(enGuildCampType eCamp) { m_eCamp = eCamp; }
    enGuildCampType GetNpcCamp() const { return m_eCamp; }
    bool IsDynamicNpc() { return m_iSpawnId >= 0; }
    void SetSpawnId(int iSpawnId, int iLocationId, int iSpawnEndTime);
    int GetSpawnId() const { return m_iSpawnId; }
    int GetLocationId() const { return m_iLocationId; }
    void SetNpcGroupId(int iNpcGroupId) { m_iNpcGroupId = iNpcGroupId; }
    int GetNpcGroupId() const { return m_iNpcGroupId; }
    void SetRemove() { m_bIsRemove = true; }
    NFCityNpcLevelExt *GetLevelExt() { return &m_oLevelExt; }
private:
    int InitNpcType(int iType, int iId);
    int InitTriggerLevelNpc(int iId);
    bool IsNeedRemove();

private:
    int m_iNpcId; //npc desc id
    int m_iSpawnId; //spawn id
    int m_iLocationId; //npc location id
    int m_iNpcGroupId; //npc group id

    int m_iLastTickTime;
    int m_iLeftTime; //left time
    bool m_bIsHide; //hide

    int m_iEndTime; //activity end time... need remove

    bool m_bIsRemove; //need remove

    enGuildCampType m_eCamp;

    NFCityNpcLevelExt m_oLevelExt;
};
